package flc.ast.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyRingBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class RingAdapter extends StkProviderMultiAdapter<MyRingBean> {

    public RingAdapter() {
        addItemProvider(new StkSingleSpanProvider(30));
        addItemProvider(new RingProvider());
    }

    private class RingProvider extends BaseItemProvider<MyRingBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_ring;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyRingBean bean) {
            baseViewHolder.setText(R.id.tvRingItemName, bean.getName());
            if (bean.isSelected()) {
                baseViewHolder.setImageResource(R.id.ivRingItemSel, R.drawable.alsxz2);
            } else {
                baseViewHolder.setImageResource(R.id.ivRingItemSel, R.drawable.alswxz);
            }
        }
    }
}
